import AudioMgr from "./common/AudioMgr";
import RankDialog from "./dialog/RankDialog";

export class Global {
  audioMgr: AudioMgr = new AudioMgr();
//   rankDialog:RankDialog=new RankDialog();
}

cc.view.setResizeCallback(() => {
  setTimeout(() => {
    window[`loaded`] &&
      fgui.GRoot.inst &&
      fgui.GRoot.inst._children.forEach(component => {
        component.asCom &&
          component.asCom.setSize(
            fgui.GRoot.inst.width,
            fgui.GRoot.inst.height
          );
      });
    cc.systemEvent.emit("SCREEN_SIZE_CHANGED");
  });
});

declare global {
  export let gg: Global;
  interface Window {
    gg: Global;
    subGamePanel: fgui.GComponent;
    subGameDir?: string;
  }
}

// 注入gg全局变量
window.gg = new Global();

// if (CC_DEV) {
//   gg["im"] = im;
// }

// gg.im.start("ws://192.168.88.137:8080/ws", "1");
// initFuiExtends();
